package com.drama.demo.result;


import java.io.Serializable;
public class BaseResponse<T> implements Serializable{

    private static final long serialVersionUID = -5809782578272943995L;


    public static final String DEFAULT_CODE = "200";
    public static final String DEFAULT_MESSAGE = "ok";

    private String code =DEFAULT_CODE;

    private String message = DEFAULT_MESSAGE;

    private T data;

    public BaseResponse(String code, String message, T data) {
        this.code = (String) code;
        this.message = (String)message;
        this.data = data;
    }

    public BaseResponse(T data) {
        this((String)null, (String)null, data);
    }

    public static <T> BaseResponse ok(T data){
        return  new BaseResponse(DEFAULT_CODE, DEFAULT_MESSAGE,data) ;
    }

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }



    public T getData() {
        return this.data;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }



    public void setData(T data) {
        this.data = data;
    }
}
